package com.zj.restApi;

import com.zj.web.bean.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *  定义一个Feign客户端接口，用于调用idGenerator服务
 *  访问idGenerator服务的api接口  由openFeign生成代理对象
 */
@FeignClient(name = "idGenrator")  //得到服务名
public interface IdGenratorApi {

    @GetMapping("/id/next")
    public ResponseEntity<ResponseResult<Long>> getNextId();

    //生成多个id
    @GetMapping("/id/batch")
    public ResponseEntity<ResponseResult> getNextIds(
            @RequestParam(name = "size",defaultValue = "10") int size );
    //解析时间
    @GetMapping("/id/parse/time")
    public ResponseEntity<ResponseResult> parseTime(@RequestParam("id") Long id);
    //解析数据中心id
    @GetMapping("/id/parse/DataCenterId")
    public ResponseEntity<ResponseResult> parseDataCenterId(@RequestParam("id") Long id);
    @GetMapping("/id/parse/WorkerId")
    public ResponseEntity<ResponseResult> parseWorkerId(@RequestParam("id") Long id);

}
